<template>
  <div class="mod-demo-ueditor">
    <div>
      <el-tree
      :data="treeData"
      node-key="catId"
      ref="tree"
      highlight-current
      :expand-on-click-node="false"
      @node-click="categoryClick"
      :props="defaultProps">
      </el-tree>
    </div>
  </div>
</template>
<script>
  export default {
    data () {
      return {
        treeData: [],
        defaultProps: {
          children: 'children',
          label: 'name'
        }
      }
    },
    mounted () {
      
      this.getData()
    },
    methods: {
      getData(){
        this.$http({
            url: this.$http.adornUrl('/product/pmscategory/list/tree'),
            method: 'get',
            data: {}
        }).then(({data}) => {
            this.treeData=data.data
        })   
      },
      categoryClick(data,node,obj){
        this.$emit('categoryClick',data)
      }
    }
  }
</script>

<style lang="scss">
  .mod-demo-ueditor {
    position: relative;
    z-index: 510;
    > .el-alert {
      margin-bottom: 10px;
    }
  }
</style>